<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <title>Document</title>
</head>

<body>
  <script>
    // 1. 类的继承
    // function Father (uname, age) {
    //   this.name = uname
    //   this.age = age
    // }

    // Father.prototype.money = function () {
    //   console.log('我要赚钱');
    // }

    // function Son (uname, age) {
    //   Father.call(this, uname, age)
    // }

    // Son.prototype = new Father()
    // Son.prototype.constructor = Son

    // const son = new Son('ikun', 22)

    // console.log(son);
    // son.money()


    class Father {
      constructor(uname, age) {
        console.log(uname, age);
        this.uname = uname
        this.age = age
      }

      money () {
        console.log('我要赚钱');
      }
    }

    class Son extends Father {
      constructor(x, y, z) {
        console.log(x, y);
        super(x, y)
        this.z = z
      }
      dance () {
        console.log('beidaiku');
      }
    }

    const son = new Son('cxk', 24, '鸡')
    const father = new Father('ldh', 60)
    console.log(son);
    console.log(father);
  </script>
</body>

</html>